﻿@model CSEPT.Models.UserViewModel
@{
    ViewBag.Title = "Your Events and Photos";
}
<h2>Events I am registered for</h2>
<div class="row">
    @foreach (CSEPT.Event e in Model.RegisteredEvents)
    {
       <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 event">
            <div class="event">
                <div class="event-links">

                    @if (Model.isLoggedIn) { 
                        <a href="@Url.Action("Add", "Photo", new {@EventID = e.ID})" class="btn btn-default upload pull-right" data-toggle="tooltip" title="Upload Photos"><span class="glyphicon glyphicon-upload"></span></a>
                        <a href="@Url.Action("Register", "Register", new {@EventID = e.ID})" class="btn btn-default register pull-right" data-toggle="tooltip" title="Register/Modify Registration"><span class="glyphicon glyphicon-list-alt"></span></a>
                        if (e.Owner.ID == Model.CurrUser.ID)
                        {
                            <a href="@Url.Action("Modify", "Event", new {@EventID = e.ID })" data-toggle="tooltip" class="btn pull-right btn-default edit" title="Modify Event"><span class="glyphicon glyphicon-edit"></span></a>
                        }
                    }
                </div>
                <div class="event-bg">
                    @if (e.Thumbnail.ID != 0) { 
                        <img class="img-responsive" src="@Url.Content("~/EventPhotos/" + @e.Thumbnail.ID + "_raw.jpg")" />
                    }
                    else
                    {
                        
                    }
                    <div class="bigfill"></div>
                </div>
                <div class="event-info">
                    <h4><a href="@Url.Action("Event", "Photo", new {@EventID = e.ID})">@e.Title</a> &nbsp;<small><small>@e.StartDate.ToString("MM/dd/yyyy") - @e.EndDate.ToString("MM/dd/yyyy")</small></small></h4>
                    <p>@e.Description</p>
                </div>
            </div>

        </div>
    }
    @if (Model.RegisteredEvents.Count < 1)
    {
        <div class="col-xs-12">
            <p>You have not registered for any events. Go to the home page to register for events.</p>
        </div>
    }
</div>
<hr class="divider" />
<h2>Photos I am tagged in</h2>
<div class="row">
    @foreach (CSEPT.Photo Phto in Model.TaggedPhotos)
    {

          <div class="col-xs-12 col-sm-4 col-md-3 col-lg-2" style="">
            <div class="photo">
                <div class="links">
                    @if (Phto.Photographer.ID == Model.CurrUser.ID)
                    {
                        <a href="@Url.Action("Delete", "Photo", new { @PhotoID = Phto.ID, @EventID = Phto.PhotoEvent.ID })" style="margin-left: 5px;" class="btn btn-danger upload pull-left" data-toggle="tooltip" title="Delete Photo"><span class="glyphicon glyphicon-trash"></span></a>
                    }
                    <a href="@Url.Action("View", "Photo", new { @PhotoID = Phto.ID})" class="btn btn-default upload pull-right" data-toggle="tooltip" title="View Photo"><span class="glyphicon glyphicon-eye-open"></span></a>
                    @if (Model.CurrUser.Credits > 2)
                    {
                        <a target="_blank" onclick="location.reload();" href="@Url.Action("Download", "Photo", new { @PhotoID = Phto.ID})" class="btn btn-default upload pull-right" data-toggle="tooltip" title="Download Photo (3 Credits)"><span class="glyphicon glyphicon-download-alt"></span></a>
                    }
                    else
                    {
                        <a href="#" onclick="toastr.error($(this).data('original-title'))" class="btn btn-warning upload pull-right" data-toggle="tooltip" title="Insufficient Credits you must tag more photos to download this photo"><span class="glyphicon glyphicon-download-alt"></span></a>
                    }
                </div>
                <div class="phto">
                    <img src="@Url.Content("~/EventPhotos/" + Phto.ID + "_thumbnail.jpg")"  class="img-responsive" onclick="ShowModal(@Phto.ID)" />
                </div>
            </div>
        </div>
    }
    @if (Model.TaggedPhotos.Count < 1)
    {
        <div class="col-xs-12">
            <p><a href="@Url.Action("View", "Photo", new { @PhotoID = 0 })">There are no tagged photos of you. Why not tag some?</a></p>
        </div>
    }
</div>

<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
    });
</script>